package com.awesome.spring.action;

import io.seata.rm.tcc.api.BusinessActionContext;
import io.seata.rm.tcc.api.BusinessActionContextParameter;
import io.seata.rm.tcc.api.LocalTCC;
import io.seata.rm.tcc.api.TwoPhaseBusinessAction;

/**
 * AccountReduceAction
 *
 * @author alex wu
 * @date 2023/10/16
 */
@LocalTCC
public interface AccountReduceAction {

    @TwoPhaseBusinessAction(name = "account-reduce", commitMethod = "commit", rollbackMethod = "cancel")
    boolean reduce(@BusinessActionContextParameter(paramName = "userId") String userId, @BusinessActionContextParameter(paramName = "money") int money);

    boolean commit(BusinessActionContext businessActionContext);

    boolean cancel(BusinessActionContext businessActionContext);
}
